<template>
  <view>
    <span class="titleStyle">{{ title }}</span>
    <uni-badge text="1" />
    <uni-badge text="2" type="success" />
    <uni-badge text="3" type="primary" :inverted="true" />
  </view>
</template>

<script setup lang="ts">
  import { isNull, isEmpty } from '@/utils/is';
  import { onMounted, ref } from 'vue';
  import { getTest } from '@/services/api/user';
  import { ResultEnum } from '@/enums/httpEnum';
  import { getUserInfo } from '@/services/api/user/user';

  onMounted(() => {
    // getMethod();
    getUserInfo().then(({ data }) => {
      if (ResultEnum.SUCCESS == data.code) {
        console.log(JSON.stringify(data.data));
      }
    });
  });

  const title = ref<string>('');
  const str = null;
  const getTitle = () => {
    console.log('isNull->' + isNull(str));
    console.log('isEmpty->' + isEmpty(str));
    title.value = '测试页面';
    return title;
  };

  const getMethod = () => {
    getTest().then((res: any) => {
      if (ResultEnum.SUCCESS == res.code) {
        console.log(JSON.stringify(res.code));
      }
    });
  };
</script>

<style scoped lang="scss">
  .titleStyle {
    color: '#ff6a6c';
    background-color: '#fa436a';
  }
</style>
